# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-vividcortex-gohistogram
pkgver=1.0.0
pkgrel=1
pkgdesc="Streaming approximate histograms in Go"
arch=('any')
url="https://github.com/VividCortex/gohistogram"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/VividCortex/gohistogram/archive/v$pkgver.tar.gz")
sha512sums=('0fb57644521135823169e9a945a7dae3702e44310f756a8e5342ef74eeb35615426d8958fff2b76c499ae6c0b1e1992034bdb67a8321b09969f88f1bb7325e6c')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/VividCortex
  cp -a "$srcdir"/gohistogram-$pkgver "$srcdir"/build/src/github.com/VividCortex/gohistogram
  cd "$srcdir"/build/src/github.com/VividCortex/gohistogram
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/VividCortex
  cp -a "$srcdir"/gohistogram-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/VividCortex/gohistogram

  install -Dm644 gohistogram-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
